﻿using System;
using System.Collections.Generic;
using System.Text;
using DotNetty.Buffers;
namespace Athena.Transport.DotNetty
{
    using Message;
    using Codec;
    public abstract class DotNettyTransportMessageSender
    {
        private readonly IRpcMessageEncoder _rpcMessageEncoder;

        protected DotNettyTransportMessageSender(IRpcMessageEncoder rpcMessageEncoder)
        {
            _rpcMessageEncoder = rpcMessageEncoder;
        }

        protected IByteBuffer GetByteBuffer(RpcTransportMessage rpcTransportMessage)
        {
            var data = _rpcMessageEncoder.MessageEncoding(rpcTransportMessage);
            
            return Unpooled.WrappedBuffer(data);
        }
    }
}
